<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/mui.picker.min.css" />
		<link rel="stylesheet" href="../../css/iconfont.css">
		<style>
			.mui-content-padded{margin:5px 0 0 0;}
			.mui-row-list span{float: left; line-height:33px; width:20%;}
			.mui-row-list select{float: left; line-height:14px; font-size:14px; margin-top:2px; margin-left: 5px;}
			.mui-btn-block{margin-bottom:0; padding:6px;}
			.mui-col-sm-12{ border-top: 1px solid #D1D1D1; width:100%; padding-top:5px; font-size:14px;}
			input{text-align: left;}
			input[type="text"]{height:30px; margin-bottom: 5px;}
			input[readonly="readonly"]{ text-align: left; padding-left: 5px; padding-right: 0;}
			input{border-width: 0; height: 26px; float: right; text-align: right; padding-right: 15px;}
			form:before{ background: none !important; border: none !important;}
			
			.mui-switch:before {content: '选择'; color: #fff;}
			.mui-switch{border-color: #fd933b;background-color: #fd933b;border-width: 1px;}
			.mui-switch.mui-active:before {content: '填写'; color: #fff;}
			.mui-switch.mui-active {border-color: #007AFF;background-color: #007AFF;}
			
			.mui-switch.new1:before {content: '结案'; color: #fff;}
			.mui-switch.new1{border-color: #fd933b;background-color: #fd933b;border-width: 1px;}
			.mui-switch.mui-active.new1:before {content: '转诊'; color: #fff;}
			.mui-switch.mui-active.new1 {border-color: #007AFF;background-color: #007AFF;}
			
			.mui-switch.new2:before {content: '未见异常'; color: #fff;}
			.mui-switch.new2{border-color: #007AFF;background-color: #007AFF;border-width: 1px; width:95px;}
			.mui-switch.mui-active.new2:before {content: '异常'; color: #fff; width:95px;}
			.mui-switch.mui-active.new2 {border-color: #fd933b;background-color: #fd933b; width:95px;}
			.mui-switch.mui-active.new2 .mui-switch-handle{
				-webkit-transform: translate(63px,0);
				transform: translate(63px,0);
			}
			.mui-switch.mui-active.new3 .mui-switch-handle{
				-webkit-transform: translate(63px,0);
				transform: translate(63px,0);
			}
			
			.mui-switch.new3:before {content: '已恢复'; color: #fff; right: 15px;}
			.mui-switch.new3{border-color: #007AFF;background-color: #007AFF;border-width: 1px; width:95px;}
			.mui-switch.mui-active.new3:before {content: '未恢复'; color: #fff;}
			.mui-switch.mui-active.new3 {border-color: #fd933b;background-color: #fd933b;}
			
			.mui-table-view-cell.mui-active{ display:block;}
			.border0{border-width: 0; border-bottom: #dddddd 1px solid;}
			.ui-alert{font-size: 14px;}
			#Popup {
				width: 0px;
				height: 0px;
				background: red;
				position: fixed;
				top: 70%;
				left: 50%;
			}
			.mui-popover{
				width: 300px;
			}
			.mui-popover .mui-popover-arrow:after {
				width: 0px;
			}
			/**/

			/**/
			.popover-cont ul{
				margin-top: 5px; 
				margin: 0; 
				padding: 0; 
				list-style: none; 
				background: #ffffff;
			}
			.table{
				width: 100%;
			}
			.thead{
				width: 100%;
				border: 1px solid #007AFF;
			}
			.thead tr{
				 width: 100%; 
				 background-color: #007AFF;
				 height: 20px;
			}
			.thead tr th{
				color: #ffffff;
				border-right: 1px solid #ffffff;
				text-align: center;
				font-family: "microsoft yahei";
				font-size: 14px;
				line-height: 20px;
			}
			.tbody{
				width: 100%;
				border: 1px solid #007AFF;
			}
			.tbody tr{
				 width: 100%; 
				 height: 20px;
			}
			.tbody tr td{
				color: #000;
				border: 1px solid #007AFF;
				text-align: center;
				font-family: "microsoft yahei";
				font-size: 14px;
				line-height: 20px;
			}
			.div-tab{
				width: 100%; 
				height: 200px; 
				overflow-y: scroll;
			}
			.div-tab::-webkit-scrollbar {
				display: none;
			}
			.submit{
				margin:0 auto 10px auto; 
				width:200px; 
				height:35px; 
				line-height: 35px; 
				background-color:#007AFF; 
				text-align: center; 
				color: #FFFFFF; 
				border-radius: 10px;
			}
			.mui-ul-check{ width: 100%; margin: 0; padding: 0;}
			.mui-ul-check li{float: left; list-style-type:none; text-align: center; padding:5px; margin:2px; border:1px solid #D1D1D1;}
			.mui-ul-check li.on{ background-color:#007AFF; color:#FFFFFF; float: left; list-style-type:none; text-align: center; padding:5px; margin:2px;}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" id="high_id">产后42天</h1>
		</header>
		<div class="mui-conten" style="margin-top:50px;">
			<ul class="mui-table-view">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<a style="float: left; font-size: 14px; width: 60px; line-height: 26px;">姓名</a>
							<input  id='name-1' name="name-1" class="ui-alert border0" readonly="readonly" placeholder="" style="width:70px; float: left;"/>
							<a style="float: left; font-size: 14px; width: 60px; line-height: 26px; margin-left: 5px;">性别</a>
							<input  id='sex-1' class="ui-alert border0" readonly="readonly" placeholder="" style="width:30px; float: left;"/>
							<a style="float: left; font-size: 14px; width: 60px; line-height: 26px; margin-left: 5px;">年龄</a>
							<input  id='age-1' class="ui-alert border0" readonly="readonly" placeholder="" style="width:40px; float: left;"/>
						</li>
						<li class="mui-table-view-cell">
							<a style="float: left; font-size: 14px; width: 90px; line-height: 26px;">家庭住址</a>
							<input  id='ad-1' class="ui-alert border0" readonly="readonly" placeholder="" style="width:210px; float: left;"/>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<div style="float: left; font-size: 14px; width:120px; line-height: 26px;">所属胎次</div>
							<input  id='tire' class="ui-alert border0" class="ui-alert" style="width:50%;"/>
						</li>
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">随访日期</div>
								<input id="result0" class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">分娩日期</div>
								<input id="result1" class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
						<li class="mui-table-view-cell">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<div style="float: left; font-size: 14px; width: 90px; line-height: 26px;">出院日期</div>
								<input id="result2" class="ui-alert"  placeholder="请选择" style="width:50%;"/>
							</a>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<div style="float: left; font-size: 14px; width:90px; line-height: 26px;">一般健康状况</div>
							<input  id='health' class="ui-alert border0" class="ui-alert" style="width:70%;"/>
						</li>
						<li class="mui-table-view-cell">
							<div style="float: left; font-size: 14px; width:90px; line-height: 26px;">一般心理状况</div>
							<input  id='psychological' class="ui-alert border0" class="ui-alert" style="width:70%;"/>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell" style="float: left; line-height: 26px;">
							<div style="float: left; font-size: 16px; width:5rem;">血压</div>
							<input class="ui-alert border0" id="sbp"  placeholder="单位" style="float: left; width:23%;"/>
							<a style="width: 10px; padding: 0; margin: 0; line-height: 26px; float: left; text-align: center;">/</a>
							<input class="ui-alert border0" id="dbp"  placeholder="单位" style="float: left; width:23%;"/>mmhg
						</li>
						<li class="mui-table-view-cell">
							<div style="float: left; font-size:16px;">乳房</div>
							<div class="mui-switch new2" id="mySwitch1">
							  <div class="mui-switch-handle"></div>
							</div>
						</li>
						<li class="mui-table-view-cell" id="rufang" style="display: none;">
							<input class="ui-alert border0" id="rufang_t"  placeholder="请输入异常" style="float: left; width:100%; text-align: right; padding: 0 10px;"/>
						</li>
						<li class="mui-table-view-cell">
							<div style="float: left; font-size:16px;">恶露</div>
							<div class="mui-switch new2" id="mySwitch2">
							  <div class="mui-switch-handle"></div>
							</div>
						</li>
						<li class="mui-table-view-cell" id="elu" style="display: none;">
							<input class="ui-alert border0" id="elu_t"  placeholder="请输入异常" style="float: left; width:100%; text-align: right; padding: 0 10px;"/>
						</li>
						<li class="mui-table-view-cell">
							<div style="float: left; font-size:16px;">子宫</div>
							<div class="mui-switch new2" id="mySwitch3">
							  <div class="mui-switch-handle"></div>
							</div>
						</li>
						<li class="mui-table-view-cell" id="zigong" style="display: none;">
							<input class="ui-alert border0" id="zigong_t"  placeholder="请输入异常" style="float: left; width:100%; text-align: right; padding: 0 10px;"/>
						</li>
						<li class="mui-table-view-cell">
							<div style="float: left; font-size:16px;">伤口</div>
							<div class="mui-switch new2" id="mySwitch4">
							  <div class="mui-switch-handle"></div>
							</div>
						</li>
						<li class="mui-table-view-cell" id="shangkou" style="display: none;">
							<input class="ui-alert border0" id="shangkou_t"  placeholder="请输入异常" style="float: left; width:100%; text-align: right; padding: 0 10px;"/>
						</li>
						<li class="mui-table-view-cell">
							<div style="float: left; font-size: 14px; width:60px; line-height: 26px;">其他</div>
							<input  id='zdother' class="ui-alert border0" class="ui-alert" style="width:75%;"/>
						</li>
					</div>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-col-sm-12 mui-col-xs-12">
					<li class="mui-table-view-cell">
						<div style="float: left; font-size:16px;">分类</div>
						<div class="mui-switch new3" id="mySwitch5">
						  <div class="mui-switch-handle"></div>
						</div>
					</li>
					<li class="mui-table-view-cell" id="fenlei" style="display: none;">
						<input class="ui-alert border0" id="fenlei_t"  placeholder="请输入" style="float: left; width:100%; text-align: right; padding: 0 10px;"/>
					</li>
				</div>
			</ul>
			<div style="clear:both; font-size: 16px; line-height:25px; margin-left:15px; margin-top: 5px;">指导</div>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-col-sm-12 mui-col-xs-12">
					<li class="mui-table-view-cell">
						<ul class="mui-ul-check" id="ularry">
							<li value="606">心理保健</li>
							<li value="607">性保健与避孕</li>
							<li value="608">婴儿喂养</li>
							<li value="609">产妇营养</li>
							<li value="482" id="other12">其他</li>
						</ul>
						<li class="mui-table-view-cell" style="display: none;" id="other12_op">
							<input id='other12_text' class="ui-alert bottom_soild"  placeholder="请输入其他" style="width:100%; float:right; margin-right:15px;"/>
						</li>
					</li>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-col-sm-12 mui-col-xs-12">
					<li class="mui-table-view-cell">
						<div style="float: left; font-size:14px;">处理</div>
						<div class="mui-switch new1" id="mySwitch6">
						  <div class="mui-switch-handle"></div>
						</div>
					</li>
					<li class="mui-table-view-cell" id="chuli" style="display: none;">
						<div style="float: left; width:100%;">
							<div style="float: left; font-size: 16px; width:50px; text-align:center;">原因:</div>
							<input id='chuli_why' class="ui-alert border0"  placeholder="请输入" style="width:60%; margin-left: 6px;"/>
						</div>
						<div style="float: left; width:100%;">
							<div style="float: left; font-size: 16px; width:90px; text-align:center;">机构及科室:</div>
							<input id='chuli_det' class="ui-alert border0"  placeholder="请输入" style="width:60%; margin-left: 6px;"/>
						</div>
					</li>
				</div>
			</ul>
			<ul class="mui-table-view" style="margin-top: 5px;">
				<div class="mui-row">
					<div class="mui-col-sm-12 mui-col-xs-12">
						<li class="mui-table-view-cell">
							<div style="float: left; font-size:16px;">医生签名</div>
							<div class="mui-switch" id="mySwitch_x">
							  <div class="mui-switch-handle"></div>
							</div>
						</li>
						<li class="mui-table-view-cell" id="tigshow_doc_1">
							<a data-options='{"type":"date"}' class="btn mui-navigate-right">
								<input id='result3' class="ui-alert"  placeholder="请选择" style="width:50%; text-align: right; float: right; padding-right: 15px;"/>
							</a>
						</li>
						<li class="mui-table-view-cell" style="display: none;" id="tigshow_doc_2">
							<div style="float: left; width:100%;">
								<div style="float: left; font-size: 16px; width:5rem; text-align:center;">医院</div>
								<input id='text-hosp' class="ui-alert bottom_soild"  placeholder="请输入" style="width:60%; margin-left: 6px;"/>
							</div>
							<div style="float: left; width:100%;">
								<div style="float: left; font-size: 16px; width:5rem; text-align:center;">医生</div>
								<input id='text-doc' class="ui-alert bottom_soild"  placeholder="请输入" style="width:60%; margin-left: 6px;"/>
							</div>
						</li>
					</div>
				</div>
			</ul>
			<ul style="padding:10px 15px; margin: 0;">
				<p style="color: red; margin: 0;">
					提示：
					</br>
					若随方医生是省外的，则使用“填写”方式，手工输入随方医生信息。
					</br>
					若随方医生是省内的，则使用“选择”方式，选择对应医院和随方医生。
				</p>
			</ul>
			<div onclick="submit()" class="submit" >提交</div>
		</div>
		<script src="../../js/mui.js"></script>
		<script src="../../js/mui.picker.min.js"></script>
		<script src="../../js/jquery.min-1.11.1.js"></script>
		<script src="../../js/request.js"></script>
		<script type="text/javascript">
			var id = 0,
				ehrId = "",
				parity = "",//胎次
				visitLevel = 4,//1、产前第一次随访 2、产前2-5次随访 3、产后随访 4、产后24天随访
				visitDate = "",//随访时间
				nextDate = "",
				doctorName = "",
				visitItem = 0,
				gestationalWeeks = 0,
				createUser = "",
				updateUser = "",
				createDate = "",
				updateDate = "",
				enableFlag = 1,
				doctorId = "",
				doctorHospId = "",
				doctorHospName = "",
				xkSign = null,
				ipOutDate = "",
				childbirthDate = "",
				versionNum = 2018,
				ifVisit = 0,
				readcardCheck = 2;
			var listdata = "";
			var selfdata = "";
			var dated;
			var dateov;
			var newdate = new Date();
			var self1 = localStorage.getItem("name")
			var dataself = JSON.parse(self1)
			console.log(dataself)
			doctorName = dataself.obj.userName;//责任(评估)医生名字
			doctorId = dataself.obj.id;//责任(评估)医生id
			doctorHospId = dataself.obj.hospId;//责任(评估)医生医院id
			createHospId = dataself.obj.hospId;//创建医院id
			doctorHospName = dataself.obj.hospName;//责任(评估)医生医院名称
			document.getElementById("result3").value = dataself.obj.userName;//前台显示
			mui.plusReady(function(){
				var self = plus.webview.currentWebview()
					listdata = self.data
					selfdata = JSON.parse(listdata)
					console.log(JSON.stringify(selfdata))
					//赋值
				var date1 = new Date();
				var year1=date1.getFullYear(); 
				var month1=date1.getMonth()+1;
				var day1=date1.getDate();
				var h1=date1.getHours();
				var m1=date1.getMinutes();
				var s1=date1.getSeconds();
					month1 =(month1<10 ? "0"+month1:month1); 
					day1 =(day1<10 ? "0"+day1:day1); 
					h1 =(h1<10 ? "0"+h1:h1); 
					m1 =(m1<10 ? "0"+m1:m1); 
					s1 =(s1<10 ? "0"+s1:s1);
				var newDate = (year1.toString()+'-'+month1.toString()+'-'+day1.toString()+' '+h1.toString()+':'+m1.toString()+':'+s1.toString())
					ehrId = selfdata.ehrId
					if(selfdata.id != undefined){
						id = selfdata.id;
						document.getElementById("tire").value = selfdata.parity;
						if(selfdata.visitDate != ""){//随访日期
							var datev = new Date(selfdata.visitDate);
							var yearv=datev.getFullYear(); 
							var monthv=datev.getMonth()+1;
							var dayv=datev.getDate();
								monthv =(monthv<10 ? "0"+monthv:monthv); 
								dayv =(dayv<10 ? "0"+dayv:dayv); 
							var datab = (yearv.toString()+'-'+monthv.toString()+'-'+dayv.toString());
							document.getElementById("result0").value = datab;
						}else{
							document.getElementById("result0").value = "";
						}
						nextDate = selfdata.nextDate;
						doctorName = selfdata.doctorName;
						visitItem = selfdata.visitItem;
						gestationalWeeks = selfdata.gestationalWeeks;
						createUser = selfdata.createUser;
						updateUser = selfdata.updateUser;
						createDate = selfdata.createDate;
						updateDate = selfdata.updateDate;
						doctorId = selfdata.doctorId;
						doctorHospId = selfdata.doctorHospId;
						doctorHospName = selfdata.doctorHospName;
						if(selfdata.ipOutDate != ""){//出院日期
							var datev = new Date(selfdata.ipOutDate);
							var yearv=datev.getFullYear(); 
							var monthv=datev.getMonth()+1;
							var dayv=datev.getDate();
								monthv =(monthv<10 ? "0"+monthv:monthv); 
								dayv =(dayv<10 ? "0"+dayv:dayv); 
							var datab = (yearv.toString()+'-'+monthv.toString()+'-'+dayv.toString());
							document.getElementById("result2").value = datab;
						}else{
							document.getElementById("result2").value = "";
						}
						if(selfdata.childbirthDate != ""){//分娩日期
							var datev = new Date(selfdata.childbirthDate);
							var yearv=datev.getFullYear(); 
							var monthv=datev.getMonth()+1;
							var dayv=datev.getDate();
								monthv =(monthv<10 ? "0"+monthv:monthv); 
								dayv =(dayv<10 ? "0"+dayv:dayv); 
							var datab = (yearv.toString()+'-'+monthv.toString()+'-'+dayv.toString());
							document.getElementById("result1").value = datab;
						}else{
							document.getElementById("result1").value = "";
						}
						mui.ajax(getRequestUrl.url+'/mobile/ehr/maternalHealthAnswer/getVisitDetail',{
							data:{
								"m_id":id,
								"ehr_id":ehrId
							},
							dataType:'json',//服务器返回json格式数据
							type:'post',//HTTP请求类型
							timeout:10000,//超时时间设置为10秒；
							success:function(data){
								console.log("获取成功")
								var rows = data.rows;
								if (data.status == 1) {
									for(var i=0; i<rows.length; i++){
										if(rows[i].questionId == "738"){//分娩日期
											if(rows[i].answer != ""){
												var datev = new Date(rows[i].answer);
												var yearv=datev.getFullYear(); 
												var monthv=datev.getMonth()+1;
												var dayv=datev.getDate();
													monthv =(monthv<10 ? "0"+monthv:monthv); 
													dayv =(dayv<10 ? "0"+dayv:dayv); 
												var datab = (yearv.toString()+'-'+monthv.toString()+'-'+dayv.toString());
												document.getElementById("result1").value = datab;
											}else{
												document.getElementById("result1").value = "";
											}
										}
										if(rows[i].questionId == "739"){//出院日期
											if(rows[i].answer != ""){
												var datev = new Date(rows[i].answer);
												var yearv=datev.getFullYear(); 
												var monthv=datev.getMonth()+1;
												var dayv=datev.getDate();
													monthv =(monthv<10 ? "0"+monthv:monthv); 
													dayv =(dayv<10 ? "0"+dayv:dayv); 
												var datab = (yearv.toString()+'-'+monthv.toString()+'-'+dayv.toString());
												document.getElementById("result2").value = datab;
											}else{
												document.getElementById("result2").value = "";
											}
										}
										if(rows[i].questionId == "646"){//一般健康情况
											document.getElementById("health").value = rows[i].answer;
										}
										if(rows[i].questionId == "647"){//一般心理情况
											document.getElementById("psychological").value = rows[i].answer;
										}
										if(rows[i].questionId == "85"){//血压1
											document.getElementById("sbp").value = rows[i].answer;
										}
										if(rows[i].questionId == "86"){//血压2
											document.getElementById("dbp").value = rows[i].answer;
										}
										if(rows[i].questionId == "648"){//乳房
											if(rows[i].answerId != "180"){
												document.getElementById("rufang").style.display = "block";
												document.getElementById("mySwitch1").classList.add('mui-active');
											}else{
												document.getElementById("rufang").style.display = "none";
												document.getElementById("mySwitch1").classList.remove('mui-active');
											}
										}
										if(rows[i].questionId == "649"){//乳房异常
											document.getElementById("rufang_t").value = rows[i].answer;
										}
										if(rows[i].questionId == "650"){//恶露
											if(rows[i].answerId != "180"){
												document.getElementById("elu").style.display = "block";
												document.getElementById("mySwitch2").classList.add('mui-active');
											}else{
												document.getElementById("elu").style.display = "none";
												document.getElementById("mySwitch2").classList.remove('mui-active');
											}
										}
										if(rows[i].questionId == "651"){//恶露异常
											document.getElementById("elu_t").value = rows[i].answer;
										}
										if(rows[i].questionId == "652"){//子宫
											if(rows[i].answerId != "180"){
												document.getElementById("zigong").style.display = "block";
												document.getElementById("mySwitch3").classList.add('mui-active');
											}else{
												document.getElementById("zigong").style.display = "none";
												document.getElementById("mySwitch3").classList.remove('mui-active');
											}
										}
										if(rows[i].questionId == "653"){//子宫异常
											document.getElementById("zigong_t").value = rows[i].answer;
										}
										if(rows[i].questionId == "654"){//伤口
											if(rows[i].answerId != "180"){
												document.getElementById("shangkou").style.display = "block";
												document.getElementById("mySwitch4").classList.add('mui-active');
											}else{
												document.getElementById("shangkou").style.display = "none";
												document.getElementById("mySwitch4").classList.remove('mui-active');
											}
										}
										if(rows[i].questionId == "655"){//伤口异常
											document.getElementById("shangkou_t").value = rows[i].answer;
										}
										if(rows[i].questionId == "440"){//其他
											document.getElementById("zdother").value = rows[i].answer;
										}
										if(rows[i].questionId == "645"){//分类
											if(rows[i].answerId != "577"){
												document.getElementById("fenlei").style.display = "block";
												document.getElementById("mySwitch5").classList.add('mui-active');
											}else{
												document.getElementById("fenlei").style.display = "none";
												document.getElementById("mySwitch5").classList.remove('mui-active');
											}
										}
										if(rows[i].questionId == "586"){//分类异常
											document.getElementById("fenlei_t").value = rows[i].answer;
										}
										if(rows[i].questionId == "638"){//指导
											var medicineYnarr = rows[i].answer;
											if(medicineYnarr != null){
												var medicineYnarr_n = medicineYnarr.split(",");
												if(medicineYnarr_n.length != 0){
													$ ("#ularry").each (function (){
														$ (this).find ('li').each (function (){
															var y = medicineYnarr_n.length-1;
															for (var i=0; i<medicineYnarr_n.length; i++) {
																if ($(this).val() == medicineYnarr_n[i]) {
											                        $(this).addClass("on");
																	if(medicineYnarr_n[y] == "482"){
																		document.getElementById("other12_op").style.display="block";
																	}else{
																		document.getElementById("other12_op").style.display="none";
																	}
											                    }		
															}
														})
													})	
												}
											}
										}
										if(rows[i].questionId == "587"){
											document.getElementById("other12_text").value = rows[i].answer;
										}
										if(rows[i].questionId == "332"){//处理
											if(rows[i].answerId != "579"){
												document.getElementById("chuli").style.display = "block";
												document.getElementById("mySwitch6").classList.add('mui-active');
											}else{
												document.getElementById("chuli").style.display = "none";
												document.getElementById("mySwitch6").classList.remove('mui-active');
											}
										}
										if(rows[i].questionId == "333"){//原因
											document.getElementById("chuli_why").value = rows[i].answer;
										}
										if(rows[i].questionId == "334"){//科室
											document.getElementById("chuli_det").value = rows[i].answer;
										}
									}
								} else {
									
								}
							},
							error:function(xhr,type,errorThrown){
								
							}
						});	
					}else{
						visitDate = newDate;//随访时间
						doctorName = dataself.obj.userName;
						createUser = dataself.obj.id;
						updateUser = dataself.obj.id;
						createDate = newDate;
						updateDate = newDate;
						doctorId = dataself.obj.id;
						doctorHospId = dataself.obj.hospId;
						doctorHospName = dataself.obj.hospName;
					};
			});	
			//内容字段部分
			mui.init()
				(function($) {
				$.init();
				var result = $('#result')[0];
				var btns = $('.btn');
				btns.each(function(i, btn) {
					btn.addEventListener('tap', function() {
						var _self = this;
						if(_self.picker) {
							_self.picker.show(function (rs) {
								result.innerText = rs.text;
								_self.picker.dispose();
								_self.picker = null;
							});
						} else {
							//alert(i)
							if(i == 3){
								var picker = new mui.PopPicker();
								 picker.setData([{value:dataself.obj.id,text:dataself.obj.userName}]);
								 picker.show(function (selectItems) {
									 $('#result'+i)[0].value = selectItems[0].text;
								  })
							}else{
								var optionsJson = this.getAttribute('data-options') || '{}';
								var options = JSON.parse(optionsJson);
								var id = this.getAttribute('id');
								/*
								 * 首次显示时实例化组件
								 * 示例为了简洁，将 options 放在了按钮的 dom 上
								 * 也可以直接通过代码声明 optinos 用于实例化 DtPicker
								 */
								_self.picker = new $.DtPicker(options);
								_self.picker.show(function(rs) {
									/*
									 * rs.value 拼合后的 value
									 * rs.text 拼合后的 text
									 * rs.y 年，可以通过 rs.y.vaue 和 rs.y.text 获取值和文本
									 * rs.m 月，用法同年
									 * rs.d 日，用法同年
									 * rs.h 时，用法同年
									 * rs.i 分（minutes 的第二个字母），用法同年
									 */
									$('#result'+i)[0].value = rs.text;
									/* 
									 * 返回 false 可以阻止选择框的关闭
									 * return false;
									 */
									/*
									 * 释放组件资源，释放后将将不能再操作组件
									 * 通常情况下，不需要示放组件，new DtPicker(options) 后，可以一直使用。
									 * 当前示例，因为内容较多，如不进行资原释放，在某些设备上会较慢。
									 * 所以每次用完便立即调用 dispose 进行释放，下次用时再创建新实例。
									 */
									_self.picker.dispose();
									_self.picker = null;
								});
							}
						}
					}, false);
				});
			})(mui);
			//切换
			document.getElementById("mySwitch_x").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("tigshow_doc_1").style.display="none";
					document.getElementById("tigshow_doc_2").style.display="block";
					doctorHospId = "0";//签名医生医院id
					doctorHospName = document.getElementById("text-hosp").value;//签名医生医院名字
					doctorId = "0";//签名医生id
					doctorName = document.getElementById("text-doc").value;//签名医生姓名
				}else{
					document.getElementById("tigshow_doc_1").style.display="block";
					document.getElementById("tigshow_doc_2").style.display="none";
					if(doctorId == ""){
						doctorHospId = "";//签名医生医院id
						doctorHospName = "";//签名医生医院名字
						doctorId = "";//签名医生id
						doctorName = "";//签名医生姓名
					}
				}
			})
			//切换
			var mySwitch1 = "180",
				mySwitch2 = "180",
				mySwitch3 = "180",
				mySwitch4 = "180",
				mySwitch5 = "578",
				mySwitch6 = "579";
			document.getElementById("mySwitch1").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("rufang").style.display="block";
					mySwitch1 = "181";
				}else{
					document.getElementById("rufang").style.display="none";
					mySwitch1 = "180";
					$("#rufang_t").val("");
				}
			})
			document.getElementById("mySwitch2").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("elu").style.display="block";
					mySwitch2 = "181";
				}else{
					document.getElementById("elu").style.display="none";
					mySwitch2 = "180";
					$("#elu_t").val("");
				}
			})
			document.getElementById("mySwitch3").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("zigong").style.display="block";
					mySwitch3 = "181";
				}else{
					document.getElementById("zigong").style.display="none";
					mySwitch3 = "180";
					$("#zigong_t").val("");
				}
			})
			document.getElementById("mySwitch4").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("shangkou").style.display="block";
					mySwitch4 = "181";
				}else{
					document.getElementById("shangkou").style.display="none";
					mySwitch4 = "180";
					$("#shangkou_t").val("");
				}
			})
			document.getElementById("mySwitch5").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("fenlei").style.display="block";
					mySwitch5 = "578";
				}else{
					document.getElementById("fenlei").style.display="none";
					mySwitch5 = "577";
					$("#fenlei_t").val("");
				}
			})
			document.getElementById("mySwitch6").addEventListener("toggle",function(event){
				if(event.detail.isActive){
					document.getElementById("chuli").style.display="block";
					mySwitch6 = "580";
				}else{
					document.getElementById("chuli").style.display="none";
					mySwitch6 = "579";
					$("#chuli_why").val("");
					$("#chuli_det").val("");
				}
			})
			//复选框事件
			mui('.mui-ul-check').on('tap', 'li', function(e) {
				if(!this.getAttribute('class')){
					this.classList.add('on');
					if($("#other12").hasClass('on')){
						$("#other12_op").css("display","block");
					}else{
						$("#other12_op").css("display","none");
						$("#other12_text").val("");
					}
				}else{
					this.classList.remove('on');
					if($("#other12").hasClass('on')){
						$("#other12_op").css("display","block");
					}else{
						$("#other12_op").css("display","none");
						$("#other12_text").val("");
					}
				}
			});
			//提交
			function submit(){
				if($("#tire")[0].value == ""){
					alert("请输入胎次")
				}else if($("#result0")[0].value == ""){
					alert("请输入随访时间")
				}else if($("#result1")[0].value == ""){
					alert("请输入分娩时间")
				}else if($("#result2")[0].value == ""){
					alert("请输入出院时间")
				}else if($("#result3")[0].value == "" && $("#text-doc")[0].value == ""){
					alert("请输入医生签名")
				}else{
					alert("可以提交")
					var my_medicineYn = ""
					$ ("#ularry").find ('.on').each (function (){
						if($(this).length != 0){
							my_medicineYn += $(this).val() + ",";	
						}
					});
					//去掉最后一个逗号(如果不需要去掉，就不用写)
					if (my_medicineYn.length > 0) {
						my_medicineYn = my_medicineYn.substr(0,my_medicineYn.length - 1);
					}else{
						my_medicineYn = "";
					}
					//乳房
					if ($("#mySwitch1").hasClass("mui-active")) {
						mySwitch1 = "181";
					}else{
						mySwitch1 = "180";
					}
					//恶露
					if ($("#mySwitch2").hasClass("mui-active")) {
						mySwitch2 = "181";
					}else{
						mySwitch2 = "180";
					}
					//子宫
					if ($("#mySwitch3").hasClass("mui-active")) {
						mySwitch3 = "181";
					}else{
						mySwitch3 = "180";
					}
					//伤口
					if ($("#mySwitch4").hasClass("mui-active")) {
						mySwitch4 = "181";
					}else{
						mySwitch4 = "180";
					}
					//分类
					if ($("#mySwitch5").hasClass("mui-active")) {
						mySwitch5 = "578";
					}else{
						mySwitch5 = "577";
					}
					//处理
					if ($("#mySwitch6").hasClass("mui-active")) {
						mySwitch6 = "580";
					}else{
						mySwitch6 = "579";
					}
					parity = $("#tire")[0].value;
					if($("#result0")[0].value != ""){
						visitDate = $("#result0")[0].value+" 00:00:00";
					}else{
						visitDate = "";
					}
					if($("#result1")[0].value != ""){
						childbirthDate = $("#result1")[0].value+" 00:00:00";
					}else{
						childbirthDate = "";
					}
					if($("#result2")[0].value != ""){
						ipOutDate = $("#result2")[0].value+" 00:00:00";
					}else{
						ipOutDate = "";
					}
					var data_object =[
						//分娩日期
						{
						questionId:"738",
						answerId:0,
						answer:childbirthDate
						},
						//出院日期
						{
						questionId:"739",
						answerId:0,
						answer:ipOutDate
						},
						//一般健康情况
						{
						questionId:"646",
						answerId:0,
						answer:$('#health').val()
						},
						//一般心理情况
						{
						questionId:"647",
						answerId:0,
						answer:$('#psychological').val()
						},
						//血压1
						{
						questionId:"85",
						answerId:0,
						answer:$('#sbp').val()
						},
						//血压2
						{
						questionId:"86",
						answerId:0,
						answer:$('#dbp').val()
						},
						//乳房
						{
						questionId:"648",
						answerId:mySwitch1,
						answer:null
						},
						//乳房异常
						{
						questionId:"649",
						answerId:0,
						answer:$('#rufang_t').val()
						},
						//恶露
						{
						questionId:"650",
						answerId:mySwitch2,
						answer:null
						},
						//恶露异常
						{
						questionId:"651",
						answerId:0,
						answer:$('#elu_t').val()
						},
						//子宫
						{
						questionId:"652",
						answerId:mySwitch3,
						answer:null
						},
						//子宫异常
						{
						questionId:"653",
						answerId:0,
						answer:$('#zigong_t').val()
						},
						//伤口
						{
						questionId:"654",
						answerId:mySwitch4,
						answer:null
						},
						//伤口异常
						{
						questionId:"655",
						answerId:0,
						answer:$('#shangkou_t').val()
						},
						//其他
						{
						questionId:"440",
						answerId:0,
						answer:$('#zdother').val()
						},
						//分类
						{
						questionId:"645",
						answerId:mySwitch5,
						answer:null
						},
						//分类异常
						{
						questionId:"586",
						answerId:0,
						answer:$('#fenlei_t').val()
						},
						//指导
						{
						questionId:"638",
						answerId:0,
						answer:my_medicineYn
						},
						//指导其他
						{
						questionId:"587",
						answerId:0,
						answer:$('#other12_text').val()
						},
						//处理
						{
						questionId:"332",
						answerId:mySwitch6,
						answer:null
						},
						//原因
						{
						questionId:"333",
						answerId:0,
						answer:$('#chuli_why').val()
						},
						//科室
						{
						questionId:"334",
						answerId:0,
						answer:$('#chuli_det').val()
						}
					]
					$.ajax(getRequestUrl.url+"/mobile/ehr/MaternalHealth/addOrUpdate",{
						data:{
							id : id,
							ehrId : ehrId,
							parity : parity,//胎次
							visitLevel : visitLevel,//1、产前第一次随访 2、产前2-5次随访 3、产后随访 4、产后24天随访
							visitDate : visitDate,//随访时间
							nextDate : nextDate,
							doctorName : doctorName,
							visitItem : visitItem,
							gestationalWeeks : gestationalWeeks,
							createUser : createUser,
							updateUser : updateUser,
							createDate : createDate,
							updateDate : updateDate,
							enableFlag : enableFlag,
							doctorId : doctorId,
							doctorHospId : doctorHospId,
							doctorHospName : doctorHospName,
							xkSign : xkSign,
							ipOutDate : ipOutDate,
							childbirthDate : childbirthDate,
							versionNum : versionNum,
							ifVisit : ifVisit,
							readcardCheck : readcardCheck
							},
						dataType:'json',//服务器返回json格式数据
						type:'post',//HTTP请求类型
						timeout:10000,//超时时间设置为10秒；
						success:function(data){
							console.log(JSON.stringify(data))
							if(data.status == 1){
								var mid = data.total;
								for(var i=0; i<data_object.length; i++){
									data_object[i].ehrId = ehrId;
									data_object[i].mid = mid;
								}
								$.ajax(getRequestUrl.url+"/mobile/ehr/maternalHealthAnswer/addOrUpdate",{
									data:JSON.stringify(data_object),
									dataType:'json',//服务器返回json格式数据
									type:'post',//HTTP请求类型
									contentType : 'application/json;charset=utf-8',
									success:function(data){
										console.log(data,"成功")
									},
									error:function(xhr,type,errorThrown){
										
									}
								});	
							}
						},
						error:function(xhr,type,errorThrown){
							
						}
					});
				}
			}
		</script>
	</body>
</html>